package com.wxzz.elearing.evaluation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wxzz.elearing.evaluation.entity.BusinessCategoryEvaluationHistory;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 能力测评 答题记录 Mapper 接口
 * </p>
 *
 * @author
 * @since 2021-04-19
 */
public interface BusinessCategoryEvaluationHistoryMapper extends BaseMapper<BusinessCategoryEvaluationHistory> {

    @Select("SELECT\n" +
            "\tcount( 1 ) \n" +
            "FROM\n" +
            "\t(\n" +
            "SELECT\n" +
            "\tCOUNT(1)\n" +
            "FROM\n" +
            "\tbusiness_category_evaluation_history \n" +
            "WHERE\n" +
            "\tenterprise_id = #{enterpriseId} \n" +
            "\tAND business_category_evaluation_id = #{businessCategoryEvaluationId}\n" +
            "\tAND deleted = 0\n" +
            "\tGROUP BY wx_user_id) business_category_evaluation_history")
    Integer selectBusinessCategoryEvaluationHistoryPerson(@Param("businessCategoryEvaluationId") Long businessCategoryEvaluationId, @Param("enterpriseId") Long enterpriseId);

}
